<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
    import="cn.edu.hbwe.book.entity.Book"
    import="java.util.ArrayList"
	import="java.util.List"
	import="cn.edu.hbwe.book.dao.impl.BookDaoImpl"
    %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
 <script type="text/javascript" src="js/delete.js"></script>
 <link href="${pageContext.request.contextPath}/admin/css/tx.css" rel="stylesheet" type="text/css">
</head>
<body>
  <%@include file="/admin/login/top.jsp"%>
   <div id=all>
   <div id=left>
    <%@include file="/admin/login/left.jsp"%>
    </div>
   <div id=right >
   
      
	<form id="Form1" name="Form1"
		action="${pageContext.request.contextPath}/findBooksByManyCondition"
		method="post">
		<table cellSpacing="1" cellPadding="0" width="100%" align="center" bgColor="#f5fafe" border="0">
			<TBODY>
				<tr>
					<td class="ta_01" align="center" bgColor="#afd1f3">
						<strong>查 询 条 件</strong>
					</td>
				</tr>
				<tr>
					<td>
						<table cellpadding="0" cellspacing="0" border="0" width="100%">
							<tr>
								<td height="22" align="center" bgColor="#f5fafe" class="ta_01">商品编号</td>
								<td class="ta_01" bgColor="#ffffff">
									<input type="text" name="id" size="15" value="" id="Form1_userName" class="bg" />
								</td>
								<td height="22" align="center" bgColor="#f5fafe" class="ta_01">类别：</td>
								<td class="ta_01" bgColor="#ffffff">
								<select name="category" id="category">
										<option value="" selected="selected">--选择商品类别--</option>
										<option value="文学">文学</option>
										<option value="生活">生活</option>
										<option value="计算机">计算机</option>
										<option value="外语">外语</option>
										<option value="经营">经营</option>
										<option value="励志">励志</option>
										<option value="社科">社科</option>
										<option value="学术">学术</option>
										<option value="少儿">少儿</option>
										<option value="艺术">艺术</option>
										<option value="原版">原版</option>
										<option value="科技">科技</option>
										<option value="考试">考试</option>
										<option value="生活百科">生活百科</option>
								</select>
								</td>
							</tr>
							<tr>
								<td height="22" align="center" bgColor="#f5fafe" class="ta_01">商品名称：</td>
								<td class="ta_01" bgColor="#ffffff">
									<input type="text" name="name" size="15" value="" id="Form1_userName" class="bg" />
								</td>
								<td height="22" align="center" bgColor="#f5fafe" class="ta_01">价格区间(元)：</td>
								<td class="ta_01" bgColor="#ffffff">
									<input type="text" name="minprice" size="10" value="" />
									- 
									<input type="text" name="maxprice" size="10" value="" />
								</td>
							</tr>
							<tr>
								<td width="100" height="22" align="center" bgColor="#f5fafe" class="ta_01"></td>
								<td class="ta_01" bgColor="#ffffff">
									<font face="宋体" color="red"> &nbsp;</font>
								</td>
								<td align="right" bgColor="#ffffff" class="ta_01">
									<br /><br />
								</td>
								<td align="right" bgColor="#ffffff" class="ta_01">
									<button type="submit" id="search" name="search" value="&#26597;&#35810;" class="button_view">
										&#26597;&#35810;
									</button> 
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
									<input type="reset" name="reset" value="&#37325;&#32622;" class="button_view" />
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td class="ta_01" align="center" bgColor="#afd1f3"><strong>商 品 列 表</strong>
					</TD>
				</tr>
				<tr>
					<td class="ta_01" align="right">
						<a href="admin/login/addBook.jsp"><button type="button" id="add" name="add" value="&#28155;&#21152;" class="button_add" onclick="addProduct()">
							添加
						</button></a>
					</td>
				</tr>
				<tr>
					<td class="ta_01" align="center" bgColor="#f5fafe">
						<table cellspacing="0" cellpadding="1" rules="all"
							bordercolor="gray" border="1" id="DataGrid1"
							style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; BORDER-LEFT: gray 1px solid; WIDTH: 100%; WORD-BREAK: break-all; BORDER-BOTTOM: gray 1px solid; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #f5fafe; WORD-WRAP: break-word">
							<tr style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; HEIGHT: 25px; BACKGROUND-COLOR: #afd1f3">
								<td align="center" width="24%">商品编号</td>
								<td align="center" width="18%">商品名称</td>
								<td align="center" width="9%">商品价格</td>
								<td align="center" width="9%">商品数量</td>
								<td width="8%" align="center">商品类别</td>
								<td width="8%" align="center">编辑</td>
								<td width="8%" align="center">删除</td>
							</tr>
                            <!--  循环输出所有商品 -->
                            <% 
			
                            if(request.getAttribute("books")!=null){
               				 ArrayList<Book> list = (ArrayList)request.getAttribute("books"); 
			
				int len = list.size();
			for(int i=0;i<len;i++){	
			%>	
			<tr onmouseover="this.style.backgroundColor = 'white'"
									onmouseout="this.style.backgroundColor = '#F5FAFE';">
									<td style="CURSOR: hand; HEIGHT: 22px" align="center" width="200"><%=list.get(i).getId()%></td>
									<td style="CURSOR: hand; HEIGHT: 22px" align="center" width="18%"><%=list.get(i).getName()%></td>
									<td style="CURSOR: hand; HEIGHT: 22px" align="center" width="8%"><%=list.get(i).getPrice()%></td>
									<td style="CURSOR: hand; HEIGHT: 22px" align="center" width="8%"><%=list.get(i).getPnum()%></td>
									<td style="CURSOR: hand; HEIGHT: 22px" align="center"><%=list.get(i).getCategory()%></td>
									<td align="center" style="HEIGHT: 22px" width="7%">
									    <a href="${pageContext.request.contextPath}/updateBookMessageServlet?id=<%=list.get(i).getId()%>">
											<img src="${pageContext.request.contextPath}/client/images/i_edit.gif" border="0" style="CURSOR: hand"> 
										</a>
									</td>
									<td align="center" style="HEIGHT: 22px" width="7%">
										<a href="${pageContext.request.contextPath}/deleteBookServlet?id=<%=list.get(i).getId()%>" onclick="sure_delete()">
												<img src="${pageContext.request.contextPath}/client/images/i_del.gif"
												width="16" height="16" border="0" style="CURSOR: hand">
										</a>
										<script type="text/javascript">
	function sure_delete(){
		if(!confirm("确认要删除？")){
			window.event.returnValue = false;
			}
	}
        </script>
									</td>
								</tr>
	      <%}} %>
						</table>
					</td>
				</tr>
			</TBODY>
		</table>
	</form>
	 </div>
    </div>
        <%@include file="/admin/login/bottom.jsp"%>
</body>
</html>